package com.senlingspace.web.controller.headquarters;


import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.senlingspace.common.annotation.Log;
import com.senlingspace.common.core.controller.BaseController;
import com.senlingspace.common.core.domain.AjaxResult;
import com.senlingspace.common.enums.BusinessType;
import com.senlingspace.system.domain.SlkjEquipmentInfo;
import com.senlingspace.system.service.ISlkjEquipmentInfoService;
import com.senlingspace.common.utils.poi.ExcelUtil;
import com.senlingspace.common.core.page.TableDataInfo;

/**
 * 设备信息列Controller
 *
 * @author wangliang
 * @date 2024-12-06
 */
@RestController
@RequestMapping("/system/equipment/info")
public class SlkjEquipmentInfoController extends BaseController
{
    @Autowired
    private ISlkjEquipmentInfoService slkjEquipmentInfoService;

    /**
     * 查询设备信息列列表
     */
    @PreAuthorize("@ss.hasPermi('system:info:list')")
    @GetMapping("/list")
    public TableDataInfo list(SlkjEquipmentInfo slkjEquipmentInfo)
    {
        startPage();
        List<SlkjEquipmentInfo> list = slkjEquipmentInfoService.selectSlkjEquipmentInfoList(slkjEquipmentInfo);
        return getDataTable(list);
    }


    /**
     * 获取设备信息列详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:info:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(slkjEquipmentInfoService.selectSlkjEquipmentInfoById(id));
    }

    /**
     * 新增设备信息列
     */
    @PreAuthorize("@ss.hasPermi('system:info:add')")
    @Log(title = "设备信息列", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SlkjEquipmentInfo slkjEquipmentInfo)
    {
        return toAjax(slkjEquipmentInfoService.insertSlkjEquipmentInfo(slkjEquipmentInfo));
    }

    /**
     * 修改设备信息列
     */
    @PreAuthorize("@ss.hasPermi('system:info:edit')")
    @Log(title = "设备信息列", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SlkjEquipmentInfo slkjEquipmentInfo)
    {
        return toAjax(slkjEquipmentInfoService.updateSlkjEquipmentInfo(slkjEquipmentInfo));
    }

    /**
     * 删除设备信息列
     */
    @PreAuthorize("@ss.hasPermi('system:info:remove')")
    @Log(title = "设备信息列", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(slkjEquipmentInfoService.deleteSlkjEquipmentInfoByIds(ids));
    }
}

